﻿//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;
//using System.Threading.Tasks;
//using OpenTK.Graphics.OpenGL4;
//namespace Common {
//    public class VertexAttribs<T> where T : unmanaged {
//        public struct VertexAttrib {
//            /// <summary>
//            /// for example, a vector3 has 3 element of float
//            /// </summary>
//            public int ElementCount;
//            public VertexAttribPointerType ElementType;
//            public bool Normalized;
//        }

//        int elementSize = GLUtility.SizeOf<T>();
//        List<VertexAttrib> attribs = new List<VertexAttrib>(4);
//        int totalElementSize = 0;
//        public VertexAttribs() {

//        }
//        public void AddAttrib(int elementCount, VertexAttribPointerType elementType = VertexAttribPointerType.Float, bool normalized = false) {
//            attribs.Add(new VertexAttrib { ElementCount = elementCount, ElementType = elementType, Normalized = normalized });
//            totalElementSize += elementCount * elementSize;
//        }
//        public void Enable() {

//            for (int i = 0; i < attribs.Count; i++) {
//                GL.VertexAttribPointer(i, attribs[i].ElementCount, attribs[i].ElementType, attribs[i].Normalized, totalElementSize, i * elementSize);
//                GL.EnableVertexAttribArray(i);
//            }

//        }
//        public void Disable() {
//            for (int i = 0; i < attribs.Count; i++) {
//                GL.DisableVertexAttribArray(i);
//            }
//        }
//    }
//    public class VertexAttribs : VertexAttribs<float> {
//    }
//}
